﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->

<UserControl
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
  xmlns:toolkitPrimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Toolkit"
  xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
  xmlns:samples="clr-namespace:System.Windows.Controls.Samples"
  x:Class="System.Windows.Controls.Samples.CalendarDayButtonStyleSelectorSample">
    <StackPanel>
        <StackPanel.Resources>
            <Style x:Key="BasicDayButtonStyle" TargetType="toolkitPrimitives:GlobalCalendarDayButton">
                <Setter Property="Background" Value="#FFBADDE9" />
                <Setter Property="FontSize" Value="10" />
                <Setter Property="HorizontalContentAlignment" Value="Center" />
                <Setter Property="VerticalContentAlignment" Value="Center" />
                <Setter Property="MinWidth" Value="5" />
                <Setter Property="MinHeight" Value="5" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="toolkitPrimitives:GlobalCalendarDayButton">
                            <Grid>
                                <vsm:VisualStateManager.VisualStateGroups>
                                    <vsm:VisualStateGroup x:Name="CommonStates">
                                        <vsm:VisualStateGroup.Transitions>
                                            <vsm:VisualTransition GeneratedDuration="0:0:0.1" />
                                        </vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualState x:Name="Normal" />
                                        <vsm:VisualState x:Name="MouseOver">
                                            <Storyboard>
                                                <DoubleAnimation
                                                  Storyboard.TargetName="Background"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To=".7"
                                                  Duration="0" />
                                            </Storyboard>
                                        </vsm:VisualState>
                                        <vsm:VisualState x:Name="Pressed">
                                            <Storyboard>
                                                <DoubleAnimation
                                                  Storyboard.TargetName="Background"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To=".7"
                                                  Duration="0" />
                                            </Storyboard>
                                        </vsm:VisualState>
                                        <vsm:VisualState x:Name="Disabled">
                                            <Storyboard>
                                                <DoubleAnimation
                                                  Storyboard.TargetName="Background"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To="0"
                                                  Duration="0" />
                                                <DoubleAnimation
                                                  Storyboard.TargetName="Content"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To=".35"
                                                  Duration="0" />
                                            </Storyboard>
                                        </vsm:VisualState>
                                    </vsm:VisualStateGroup>
                                    <vsm:VisualStateGroup x:Name="SelectionStates">
                                        <vsm:VisualStateGroup.Transitions>
                                            <vsm:VisualTransition GeneratedDuration="0" />
                                        </vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualState x:Name="Unselected" />
                                        <vsm:VisualState x:Name="Selected">
                                            <Storyboard>
                                                <DoubleAnimation
                                                  Storyboard.TargetName="SelectedBackground"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To=".75"
                                                  Duration="0" />
                                            </Storyboard>
                                        </vsm:VisualState>
                                    </vsm:VisualStateGroup>
                                    <vsm:VisualStateGroup x:Name="CalendarButtonFocusStates">
                                        <vsm:VisualStateGroup.Transitions>
                                            <vsm:VisualTransition GeneratedDuration="0" />
                                        </vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualState x:Name="CalendarButtonFocused">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames
                                                  Storyboard.TargetName="FocusVisual"
                                                  Storyboard.TargetProperty="Visibility"
                                                  Duration="0">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </vsm:VisualState>
                                        <vsm:VisualState x:Name="CalendarButtonUnfocused">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames
                                                  Storyboard.TargetName="FocusVisual"
                                                  Storyboard.TargetProperty="Visibility"
                                                  Duration="0">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </vsm:VisualState>
                                    </vsm:VisualStateGroup>
                                    <vsm:VisualStateGroup x:Name="ActiveStates">
                                        <vsm:VisualStateGroup.Transitions>
                                            <vsm:VisualTransition GeneratedDuration="0" />
                                        </vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualState x:Name="Active" />
                                        <vsm:VisualState x:Name="Inactive">
                                            <Storyboard>
                                                <ColorAnimation
                                                  Storyboard.TargetName="RegularDayGradientStart"
                                                  Storyboard.TargetProperty="Color"
                                                  To="#FF777777"
                                                  Duration="0" />
                                                <ColorAnimation
                                                  Storyboard.TargetName="RegularDayGradientEnd"
                                                  Storyboard.TargetProperty="Color"
                                                  To="#FF777777"
                                                  Duration="0" />
                                            </Storyboard>
                                        </vsm:VisualState>
                                    </vsm:VisualStateGroup>
                                    <vsm:VisualStateGroup x:Name="DayStates">
                                        <vsm:VisualStateGroup.Transitions>
                                            <vsm:VisualTransition GeneratedDuration="0" />
                                        </vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualState x:Name="RegularDay" />
                                        <vsm:VisualState x:Name="Today">
                                            <Storyboard>
                                                <DoubleAnimation
                                                  Storyboard.TargetName="TodayBackground"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To="1"
                                                  Duration="0" />
                                                <DoubleAnimation
                                                  Storyboard.TargetName="TodayGradientEnd"
                                                  Storyboard.TargetProperty="Offset"
                                                  To="1"
                                                  Duration="0" />
                                                <DoubleAnimation
                                                  Storyboard.TargetName="RegularDayGradientStart"
                                                  Storyboard.TargetProperty="Offset"
                                                  To="1"
                                                  Duration="0" />
                                            </Storyboard>
                                        </vsm:VisualState>
                                    </vsm:VisualStateGroup>
                                    <vsm:VisualStateGroup x:Name="BlackoutDayStates">
                                        <vsm:VisualStateGroup.Transitions>
                                            <vsm:VisualTransition GeneratedDuration="0" />
                                        </vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualState x:Name="NormalDay" />
                                        <vsm:VisualState x:Name="BlackoutDay">
                                            <Storyboard>
                                                <DoubleAnimation
                                                  Storyboard.TargetName="BlackoutVisual"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To=".2"
                                                  Duration="0" />
                                            </Storyboard>
                                        </vsm:VisualState>
                                    </vsm:VisualStateGroup>
                                </vsm:VisualStateManager.VisualStateGroups>

                                <Rectangle
                                  x:Name="TodayBackground"
                                  RadiusX="1"
                                  RadiusY="1"
                                  Opacity="0"
                                  Fill="#FFAAAAAA" />
                                <Rectangle
                                  x:Name="SelectedBackground"
                                  RadiusX="1"
                                  RadiusY="1"
                                  Opacity="0"
                                  Fill="{TemplateBinding Background}" />
                                <Rectangle
                                  x:Name="Background"
                                  RadiusX="1"
                                  RadiusY="1"
                                  Opacity=".5"
                                  Fill="{TemplateBinding Background}" />
                                <ContentControl
                                  x:Name="Content"
                                  IsTabStop="False"
                                  Content="{TemplateBinding Content}"
                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                  FontSize="{TemplateBinding FontSize}"
                                  Margin="5,1,5,1">
                                    <ContentControl.Foreground>
                                        <LinearGradientBrush>
                                            <GradientStop x:Name="TodayGradientStart" Offset="0" Color="#FFFFFFFF" />
                                            <GradientStop x:Name="TodayGradientEnd" Offset="0" Color="#FFFFFFFF" />
                                            <GradientStop x:Name="RegularDayGradientStart" Offset="0" Color="#FF333333" />
                                            <GradientStop x:Name="RegularDayGradientEnd" Offset="1" Color="#FF333333" />
                                        </LinearGradientBrush>
                                    </ContentControl.Foreground>
                                </ContentControl>

                                <Path
                                  x:Name="BlackoutVisual"
                                  Opacity="0"
                                  Margin="3"
                                  HorizontalAlignment="Stretch"
                                  VerticalAlignment="Stretch"
                                  RenderTransformOrigin="0.5,0.5"
                                  Fill="#FF000000"
                                  Stretch="Fill"
                                  Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z" />
                                <Rectangle
                                  x:Name="FocusVisual"
                                  Visibility="Collapsed"
                                  IsHitTestVisible="false"
                                  RadiusX="1"
                                  RadiusY="1"
                                  Stroke="#FF6DBDD1" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </StackPanel.Resources>

        <TextBlock Text="WeekendDayButtonStyleSelector: " />
        <toolkit:GlobalCalendar SelectionMode="MultipleRange">
            <toolkit:GlobalCalendar.CalendarDayButtonStyleSelector>
                <samples:WeekendDayButtonStyleSelector>
                    <samples:WeekendDayButtonStyleSelector.WeekdayStyle>
                        <Style
                          TargetType="toolkitPrimitives:GlobalCalendarDayButton"
                          BasedOn="{StaticResource BasicDayButtonStyle}">
                            <Setter Property="FontWeight" Value="Bold" />
                        </Style>
                    </samples:WeekendDayButtonStyleSelector.WeekdayStyle>
                    <samples:WeekendDayButtonStyleSelector.WeekendStyle>
                        <Style
                          TargetType="toolkitPrimitives:GlobalCalendarDayButton"
                          BasedOn="{StaticResource BasicDayButtonStyle}">
                            <Setter Property="FontStyle" Value="Italic" />
                            <Setter Property="Background" Value="#FF999999" />
                        </Style>
                    </samples:WeekendDayButtonStyleSelector.WeekendStyle>
                </samples:WeekendDayButtonStyleSelector>
            </toolkit:GlobalCalendar.CalendarDayButtonStyleSelector>
        </toolkit:GlobalCalendar>

        <src:SourceViewer xmlns:src="clr-namespace:System.Windows.Controls.Samples;assembly=System.Windows.Controls.Samples.Common" xmlns:sys="clr-namespace:System;assembly=mscorlib">
  <src:SourceFile Path="CalendarDayButtonStyleSelectorSample.xaml">
    <src:SourceFile.Source>
      <sys:String>&lt;!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
--&gt;

&lt;UserControl
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
  xmlns:toolkitPrimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Toolkit"
  xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
  xmlns:samples="clr-namespace:System.Windows.Controls.Samples"
  x:Class="System.Windows.Controls.Samples.CalendarDayButtonStyleSelectorSample"&gt;
    &lt;StackPanel&gt;
        &lt;StackPanel.Resources&gt;
            &lt;Style x:Key="BasicDayButtonStyle" TargetType="toolkitPrimitives:GlobalCalendarDayButton"&gt;
                &lt;Setter Property="Background" Value="#FFBADDE9" /&gt;
                &lt;Setter Property="FontSize" Value="10" /&gt;
                &lt;Setter Property="HorizontalContentAlignment" Value="Center" /&gt;
                &lt;Setter Property="VerticalContentAlignment" Value="Center" /&gt;
                &lt;Setter Property="MinWidth" Value="5" /&gt;
                &lt;Setter Property="MinHeight" Value="5" /&gt;
                &lt;Setter Property="Template"&gt;
                    &lt;Setter.Value&gt;
                        &lt;ControlTemplate TargetType="toolkitPrimitives:GlobalCalendarDayButton"&gt;
                            &lt;Grid&gt;
                                &lt;vsm:VisualStateManager.VisualStateGroups&gt;
                                    &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt;
                                        &lt;vsm:VisualStateGroup.Transitions&gt;
                                            &lt;vsm:VisualTransition GeneratedDuration="0:0:0.1" /&gt;
                                        &lt;/vsm:VisualStateGroup.Transitions&gt;
                                        &lt;vsm:VisualState x:Name="Normal" /&gt;
                                        &lt;vsm:VisualState x:Name="MouseOver"&gt;
                                            &lt;Storyboard&gt;
                                                &lt;DoubleAnimation
                                                  Storyboard.TargetName="Background"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To=".7"
                                                  Duration="0" /&gt;
                                            &lt;/Storyboard&gt;
                                        &lt;/vsm:VisualState&gt;
                                        &lt;vsm:VisualState x:Name="Pressed"&gt;
                                            &lt;Storyboard&gt;
                                                &lt;DoubleAnimation
                                                  Storyboard.TargetName="Background"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To=".7"
                                                  Duration="0" /&gt;
                                            &lt;/Storyboard&gt;
                                        &lt;/vsm:VisualState&gt;
                                        &lt;vsm:VisualState x:Name="Disabled"&gt;
                                            &lt;Storyboard&gt;
                                                &lt;DoubleAnimation
                                                  Storyboard.TargetName="Background"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To="0"
                                                  Duration="0" /&gt;
                                                &lt;DoubleAnimation
                                                  Storyboard.TargetName="Content"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To=".35"
                                                  Duration="0" /&gt;
                                            &lt;/Storyboard&gt;
                                        &lt;/vsm:VisualState&gt;
                                    &lt;/vsm:VisualStateGroup&gt;
                                    &lt;vsm:VisualStateGroup x:Name="SelectionStates"&gt;
                                        &lt;vsm:VisualStateGroup.Transitions&gt;
                                            &lt;vsm:VisualTransition GeneratedDuration="0" /&gt;
                                        &lt;/vsm:VisualStateGroup.Transitions&gt;
                                        &lt;vsm:VisualState x:Name="Unselected" /&gt;
                                        &lt;vsm:VisualState x:Name="Selected"&gt;
                                            &lt;Storyboard&gt;
                                                &lt;DoubleAnimation
                                                  Storyboard.TargetName="SelectedBackground"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To=".75"
                                                  Duration="0" /&gt;
                                            &lt;/Storyboard&gt;
                                        &lt;/vsm:VisualState&gt;
                                    &lt;/vsm:VisualStateGroup&gt;
                                    &lt;vsm:VisualStateGroup x:Name="CalendarButtonFocusStates"&gt;
                                        &lt;vsm:VisualStateGroup.Transitions&gt;
                                            &lt;vsm:VisualTransition GeneratedDuration="0" /&gt;
                                        &lt;/vsm:VisualStateGroup.Transitions&gt;
                                        &lt;vsm:VisualState x:Name="CalendarButtonFocused"&gt;
                                            &lt;Storyboard&gt;
                                                &lt;ObjectAnimationUsingKeyFrames
                                                  Storyboard.TargetName="FocusVisual"
                                                  Storyboard.TargetProperty="Visibility"
                                                  Duration="0"&gt;
                                                    &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Visible" /&gt;
                                                &lt;/ObjectAnimationUsingKeyFrames&gt;
                                            &lt;/Storyboard&gt;
                                        &lt;/vsm:VisualState&gt;
                                        &lt;vsm:VisualState x:Name="CalendarButtonUnfocused"&gt;
                                            &lt;Storyboard&gt;
                                                &lt;ObjectAnimationUsingKeyFrames
                                                  Storyboard.TargetName="FocusVisual"
                                                  Storyboard.TargetProperty="Visibility"
                                                  Duration="0"&gt;
                                                    &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /&gt;
                                                &lt;/ObjectAnimationUsingKeyFrames&gt;
                                            &lt;/Storyboard&gt;
                                        &lt;/vsm:VisualState&gt;
                                    &lt;/vsm:VisualStateGroup&gt;
                                    &lt;vsm:VisualStateGroup x:Name="ActiveStates"&gt;
                                        &lt;vsm:VisualStateGroup.Transitions&gt;
                                            &lt;vsm:VisualTransition GeneratedDuration="0" /&gt;
                                        &lt;/vsm:VisualStateGroup.Transitions&gt;
                                        &lt;vsm:VisualState x:Name="Active" /&gt;
                                        &lt;vsm:VisualState x:Name="Inactive"&gt;
                                            &lt;Storyboard&gt;
                                                &lt;ColorAnimation
                                                  Storyboard.TargetName="RegularDayGradientStart"
                                                  Storyboard.TargetProperty="Color"
                                                  To="#FF777777"
                                                  Duration="0" /&gt;
                                                &lt;ColorAnimation
                                                  Storyboard.TargetName="RegularDayGradientEnd"
                                                  Storyboard.TargetProperty="Color"
                                                  To="#FF777777"
                                                  Duration="0" /&gt;
                                            &lt;/Storyboard&gt;
                                        &lt;/vsm:VisualState&gt;
                                    &lt;/vsm:VisualStateGroup&gt;
                                    &lt;vsm:VisualStateGroup x:Name="DayStates"&gt;
                                        &lt;vsm:VisualStateGroup.Transitions&gt;
                                            &lt;vsm:VisualTransition GeneratedDuration="0" /&gt;
                                        &lt;/vsm:VisualStateGroup.Transitions&gt;
                                        &lt;vsm:VisualState x:Name="RegularDay" /&gt;
                                        &lt;vsm:VisualState x:Name="Today"&gt;
                                            &lt;Storyboard&gt;
                                                &lt;DoubleAnimation
                                                  Storyboard.TargetName="TodayBackground"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To="1"
                                                  Duration="0" /&gt;
                                                &lt;DoubleAnimation
                                                  Storyboard.TargetName="TodayGradientEnd"
                                                  Storyboard.TargetProperty="Offset"
                                                  To="1"
                                                  Duration="0" /&gt;
                                                &lt;DoubleAnimation
                                                  Storyboard.TargetName="RegularDayGradientStart"
                                                  Storyboard.TargetProperty="Offset"
                                                  To="1"
                                                  Duration="0" /&gt;
                                            &lt;/Storyboard&gt;
                                        &lt;/vsm:VisualState&gt;
                                    &lt;/vsm:VisualStateGroup&gt;
                                    &lt;vsm:VisualStateGroup x:Name="BlackoutDayStates"&gt;
                                        &lt;vsm:VisualStateGroup.Transitions&gt;
                                            &lt;vsm:VisualTransition GeneratedDuration="0" /&gt;
                                        &lt;/vsm:VisualStateGroup.Transitions&gt;
                                        &lt;vsm:VisualState x:Name="NormalDay" /&gt;
                                        &lt;vsm:VisualState x:Name="BlackoutDay"&gt;
                                            &lt;Storyboard&gt;
                                                &lt;DoubleAnimation
                                                  Storyboard.TargetName="BlackoutVisual"
                                                  Storyboard.TargetProperty="Opacity"
                                                  To=".2"
                                                  Duration="0" /&gt;
                                            &lt;/Storyboard&gt;
                                        &lt;/vsm:VisualState&gt;
                                    &lt;/vsm:VisualStateGroup&gt;
                                &lt;/vsm:VisualStateManager.VisualStateGroups&gt;

                                &lt;Rectangle
                                  x:Name="TodayBackground"
                                  RadiusX="1"
                                  RadiusY="1"
                                  Opacity="0"
                                  Fill="#FFAAAAAA" /&gt;
                                &lt;Rectangle
                                  x:Name="SelectedBackground"
                                  RadiusX="1"
                                  RadiusY="1"
                                  Opacity="0"
                                  Fill="{TemplateBinding Background}" /&gt;
                                &lt;Rectangle
                                  x:Name="Background"
                                  RadiusX="1"
                                  RadiusY="1"
                                  Opacity=".5"
                                  Fill="{TemplateBinding Background}" /&gt;
                                &lt;ContentControl
                                  x:Name="Content"
                                  IsTabStop="False"
                                  Content="{TemplateBinding Content}"
                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                  FontSize="{TemplateBinding FontSize}"
                                  Margin="5,1,5,1"&gt;
                                    &lt;ContentControl.Foreground&gt;
                                        &lt;LinearGradientBrush&gt;
                                            &lt;GradientStop x:Name="TodayGradientStart" Offset="0" Color="#FFFFFFFF" /&gt;
                                            &lt;GradientStop x:Name="TodayGradientEnd" Offset="0" Color="#FFFFFFFF" /&gt;
                                            &lt;GradientStop x:Name="RegularDayGradientStart" Offset="0" Color="#FF333333" /&gt;
                                            &lt;GradientStop x:Name="RegularDayGradientEnd" Offset="1" Color="#FF333333" /&gt;
                                        &lt;/LinearGradientBrush&gt;
                                    &lt;/ContentControl.Foreground&gt;
                                &lt;/ContentControl&gt;

                                &lt;Path
                                  x:Name="BlackoutVisual"
                                  Opacity="0"
                                  Margin="3"
                                  HorizontalAlignment="Stretch"
                                  VerticalAlignment="Stretch"
                                  RenderTransformOrigin="0.5,0.5"
                                  Fill="#FF000000"
                                  Stretch="Fill"
                                  Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z" /&gt;
                                &lt;Rectangle
                                  x:Name="FocusVisual"
                                  Visibility="Collapsed"
                                  IsHitTestVisible="false"
                                  RadiusX="1"
                                  RadiusY="1"
                                  Stroke="#FF6DBDD1" /&gt;
                            &lt;/Grid&gt;
                        &lt;/ControlTemplate&gt;
                    &lt;/Setter.Value&gt;
                &lt;/Setter&gt;
            &lt;/Style&gt;
        &lt;/StackPanel.Resources&gt;

        &lt;TextBlock Text="WeekendDayButtonStyleSelector: " /&gt;
        &lt;toolkit:GlobalCalendar SelectionMode="MultipleRange"&gt;
            &lt;toolkit:GlobalCalendar.CalendarDayButtonStyleSelector&gt;
                &lt;samples:WeekendDayButtonStyleSelector&gt;
                    &lt;samples:WeekendDayButtonStyleSelector.WeekdayStyle&gt;
                        &lt;Style
                          TargetType="toolkitPrimitives:GlobalCalendarDayButton"
                          BasedOn="{StaticResource BasicDayButtonStyle}"&gt;
                            &lt;Setter Property="FontWeight" Value="Bold" /&gt;
                        &lt;/Style&gt;
                    &lt;/samples:WeekendDayButtonStyleSelector.WeekdayStyle&gt;
                    &lt;samples:WeekendDayButtonStyleSelector.WeekendStyle&gt;
                        &lt;Style
                          TargetType="toolkitPrimitives:GlobalCalendarDayButton"
                          BasedOn="{StaticResource BasicDayButtonStyle}"&gt;
                            &lt;Setter Property="FontStyle" Value="Italic" /&gt;
                            &lt;Setter Property="Background" Value="#FF999999" /&gt;
                        &lt;/Style&gt;
                    &lt;/samples:WeekendDayButtonStyleSelector.WeekendStyle&gt;
                &lt;/samples:WeekendDayButtonStyleSelector&gt;
            &lt;/toolkit:GlobalCalendar.CalendarDayButtonStyleSelector&gt;
        &lt;/toolkit:GlobalCalendar&gt;
    &lt;/StackPanel&gt;
&lt;/UserControl&gt;</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="CalendarDayButtonStyleSelectorSample.xaml.cs">
    <src:SourceFile.Source>
      <sys:String>// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System;
using System.ComponentModel;

namespace System.Windows.Controls.Samples
{
    /// &lt;summary&gt;
    /// Sample page demonstrating the CalendarDayButtonStyleSelector.
    /// &lt;/summary&gt;
    [Sample("(2)CalendarDayButtonStyleSelector", DifficultyLevel.Basic)]
    [Category("GlobalCalendar")]
    public partial class CalendarDayButtonStyleSelectorSample : UserControl
    {
        /// &lt;summary&gt;
        /// Initializes a new instance of the
        /// CalendarDayButtonStyleSelectorSample class.
        /// &lt;/summary&gt;
        public CalendarDayButtonStyleSelectorSample()
        {
            InitializeComponent();
        }
    }
}</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="CalendarDayButtonStyleSelectorSample.xaml.vb">
    <src:SourceFile.Source>
      <sys:String>' (c) Copyright Microsoft Corporation.
' This source is subject to the Microsoft Public License (Ms-PL).
' Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
' All other rights reserved.

Imports Microsoft.VisualBasic
Imports System
Imports System.ComponentModel
Imports System.Windows
Imports System.Windows.Controls

''' &lt;summary&gt;
''' Sample page demonstrating the CalendarDayButtonStyleSelector.
''' &lt;/summary&gt;
&lt;Sample("(2)CalendarDayButtonStyleSelector", DifficultyLevel.Basic)&gt; _
&lt;Category("GlobalCalendar")&gt; _
Partial Public Class CalendarDayButtonStyleSelectorSample
    Inherits UserControl

    ''' &lt;summary&gt;
    ''' Initializes a new instance of the
    ''' CalendarDayButtonStyleSelectorSample class.
    ''' &lt;/summary&gt;
    Sub New()
        InitializeComponent()
    End Sub
End Class</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="WeekendDayButtonStyleSelector.cs">
    <src:SourceFile.Source>
      <sys:String>// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System;
using System.Windows.Controls.Primitives;

namespace System.Windows.Controls.Samples
{
    /// &lt;summary&gt;
    /// Provides a way to apply different styles for weekdays and weekends.
    /// &lt;/summary&gt;
    public class WeekendDayButtonStyleSelector : CalendarDayButtonStyleSelector
    {
        /// &lt;summary&gt;
        /// Gets or sets the style for weekdays.
        /// &lt;/summary&gt;
        public Style WeekdayStyle { get; set; }

        /// &lt;summary&gt;
        /// Gets or sets the style for weekend days.
        /// &lt;/summary&gt;
        public Style WeekendStyle { get; set; }

        /// &lt;summary&gt;
        /// Initializes a new instance of the WeekendDayButtonStyleSelector
        /// class.
        /// &lt;/summary&gt;
        public WeekendDayButtonStyleSelector()
        {
        }

        /// &lt;summary&gt;
        /// Returns a GlobalCalendarDayButton Style based on whether the day is
        /// a weekday or a weekend.
        /// &lt;/summary&gt;
        /// &lt;param name="day"&gt;The day to select a Style for.&lt;/param&gt;
        /// &lt;param name="container"&gt;The GlobalCalendarDayButton.&lt;/param&gt;
        /// &lt;returns&gt;A Style for the GlobalCalendarDayButton.&lt;/returns&gt;
        public override Style SelectStyle(DateTime day, GlobalCalendarDayButton container)
        {
            DayOfWeek d = day.DayOfWeek;
            return (d == DayOfWeek.Saturday || d == DayOfWeek.Sunday) ?
                WeekendStyle :
                WeekdayStyle;
        }
    }
}</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="WeekendDayButtonStyleSelector.vb">
    <src:SourceFile.Source>
      <sys:String>' (c) Copyright Microsoft Corporation.
' This source is subject to the Microsoft Public License (Ms-PL).
' Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
' All other rights reserved.

Imports Microsoft.VisualBasic
Imports System
Imports System.Windows.Controls
Imports System.Windows.Controls.Primitives

''' &lt;summary&gt;
''' Provides a way to apply different styles for weekdays and weekends.
''' &lt;/summary&gt;
Partial Public Class WeekendDayButtonStyleSelector
    Inherits CalendarDayButtonStyleSelector

    ''' &lt;summary&gt;
    ''' Gets or sets the style for weekdays.
    ''' &lt;/summary&gt;
    Private _weekdayStyle As Style
    Public Property WeekdayStyle() As Style
        Get
            Return _weekdayStyle
        End Get
        Set(ByVal value As Style)
            _weekdayStyle = value
        End Set
    End Property

    ''' &lt;summary&gt;
    ''' Gets or sets the style for weekend days.
    ''' &lt;/summary&gt;
    Private _weekendStyle As Style
    Public Property WeekendStyle() As Style
        Get
            Return _weekendStyle
        End Get
        Set(ByVal value As Style)
            _weekendStyle = value
        End Set
    End Property

    ''' &lt;summary&gt;
    ''' Initializes a new instance of the WeekendDayButtonStyleSelector
    ''' class.
    ''' &lt;/summary&gt;
    Public Sub New()
    End Sub

    ''' &lt;summary&gt;
    ''' Returns a GlobalCalendarDayButton Style based on whether the day is
    ''' a weekday or a weekend.
    ''' &lt;/summary&gt;
    ''' &lt;param name="day"&gt;The day to select a Style for.&lt;/param&gt;
    ''' &lt;param name="container"&gt;The GlobalCalendarDayButton.&lt;/param&gt;
    ''' &lt;returns&gt;A Style for the GlobalCalendarDayButton.&lt;/returns&gt;
    Public Overrides Function SelectStyle(ByVal day As Date, ByVal container As GlobalCalendarDayButton) As Style
        Dim d As DayOfWeek = day.DayOfWeek
        If d = DayOfWeek.Saturday Or d = DayOfWeek.Sunday Then
            Return WeekendStyle
        Else
            Return WeekdayStyle
        End If
    End Function
End Class</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
</src:SourceViewer>
    </StackPanel>
</UserControl>